package com.api.shopapi.service.impl;

import com.api.shopapi.entity.UserLonLat;
import com.api.shopapi.mapper.UserLonLatMapper;
import com.api.shopapi.service.UserLonLatService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service("UserLonLatServiceImplOne")
public class UserLonLatServiceImpl implements UserLonLatService {

    @Autowired
    private UserLonLatMapper userLonLatMapper;

    @Override
    public int insert(UserLonLat userLonLat) {
        return userLonLatMapper.insert(userLonLat);
    }

    @Override
    public int update(UserLonLat userLonLat) {
        return userLonLatMapper.update(userLonLat);
    }

    @Override
    public int delete(String userLonLatCode) {
        return userLonLatMapper.delete(userLonLatCode);
    }

    @Override
    public UserLonLat getByUserLonLatCode(String userLonLatCode) {
        return userLonLatMapper.getByUserLonLatCode(userLonLatCode);
    }

    @Override
    public UserLonLat getByUserCode(String userCode) {
        return userLonLatMapper.getByUserCode(userCode);
    }

    @Override
    public List<UserLonLat> getList() {
        return userLonLatMapper.getList();
    }

    @Override
    public
    List<UserLonLat> getListBySpanTime(String userCode, Date startTime, Date endTime){
        return userLonLatMapper.getListBySpanTime(userCode,startTime,endTime);
    }

    @Override
    public
    List<UserLonLat> getListAfterTime(String userCode, Date lastTime){
        return userLonLatMapper.getListAfterTime(userCode,lastTime);
    }

    @Override
    public PageInfo<UserLonLat> getPageList(int pageIndex, int pageSize) {
        PageHelper.startPage(pageIndex,pageSize);
        List<UserLonLat> userLonLatList = userLonLatMapper.getList();
        PageInfo<UserLonLat> userLonLatPageInfo=new PageInfo<>(userLonLatList);
        return userLonLatPageInfo;
    }


}
